<template>
  <div class="form-layout">
    <!--左侧导航-->
    <div class="nav-left">
      <customAnchor :itemList="[{ name: 'box-handle', title: '任务处理' },{ name: 'box-apply', title: '申请信息' }]" />
    </div>
    <!--表单区域-->
    <div class="form-right" ref="formRight">
      <customForm :data="form" :rules="propRules" ref="editForm" :disabled="propReadonly">
        <template #content>
          <div id="box-handle" class="box-title">任务处理</div>
          <customFormItem label="处理费用" name="amountCost" :parent="_self" :form="form"
                          :type="constCommon.formItemType.inputNumber.name"
                          appendBtn
                          ref="amountCost"
                          :config="{decimalPlaces: 2}"
          >
            <template #appendBtn>
              <span
              >
                元
              </span>
            </template>
          </customFormItem>
          <customFormItem label="处理开始时间" name="handleTimeBegin" :parent="_self" :form="form"
                          :config="{enableTimePicker: true,isWithHms: true}"
                          disabled
          />
          <customFormItem label="处理结束时间" name="handleTimeEnd" :parent="_self" :form="form"
                          :config="{enableTimePicker: true,isWithHms: true}"
                          disabled
          />
          <customFormItem
            label="处理方案"
            name="handleResultPlan"
            :parent="_self"
            :form="form"
            :type="constCommon.formItemType.textarea.name"
            fullWidth
            :config="{maxlength: 300, minRows: 1, maxRows: 5}"/>
          <customFormItem label="处理备注" name="handleRemark" :parent="_self" :form="form" full-width/>

          <div id="box-apply" class="box-title">申请信息</div>
          <customFormItem label="任务单号" name="busKey" :parent="_self" :form="form" disabled/>
          <customFormItem label="任务类型" name="typeNameAll" :parent="_self" :form="form" disabled/>
          <customFormItem label="任务来源" name="applySource" :parent="_self" :form="form" disabled />
          <customFormItem label="工单内容" name="busTitle" :parent="_self" :form="form" full-width disabled/>
          <customFormItem
            label="申请附件"
            name="fileApply"
            :parent="_self"
            :form="form"
            :type="constCommon.formItemType.slot.name"
            fullWidth
          >
            <template #content>
              <customUpload
                :data="{ fileRefId: form.id+'_apply', fileRefTable: 'wos_wo_task', fileSavePath: 'wos_wo_task'}"
                :hide="strings.isBlank(form.id)"
                hideMsg="请先保存单据后再上传"
                :max="20"
                disabled
                multiple
              />
            </template>
          </customFormItem>
        </template>
      </customForm>
    </div>
  </div>
</template>

<script>
import customAnchor from '@/components/custom/form/customAnchor.vue'
import customUpload from '@/components/custom/form/customUpload.vue'

export default {
  help: '工单系统-任务详情',
  data() {
    return {
      form: {},
      viewData: {},
    }
  },
  methods: {
  },
  created() {
    this.$emit('event-register', {
      validate: (callback) => {
        return this.$refs.editForm.validate(callback)
      },
      beforeSave: () => {
        this.$emit('data-callback', this.form)
        return true
      },
      afterMove: (formData, initData) => {
        this.form = global.utils.jsonClone(formData)
        this.viewData = this.propCurrentRow;
      },
      afterSave: () => {
      },
      beforeDelete: () => {
        return true
      },
      afterDelete: () => {
      },
      beforeFlow: (flowButtonKey) => {
        return true
      },
      afterFlow: (flowButtonKey) => {
      },
      beforeClose: () => {
        return true
      },
    })
  },
  props: {
    propParent: Object,
    propInitData: Object,
    propPrimaryKey: String,
    propDictionaries: Object,
    propCurrentRow: Object,
    propViewFormData: Object,
    propReadonly: Boolean,
    propStatus: String,
    propRules: Object,
  },
  components: { customAnchor, customUpload},
  computed: {},
}
</script>
